package com.example.forum.services;

import com.example.forum.model.Message;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author hanzishuai
 * @date 2025/4/13 14:04
 * @Description
 */
public interface IMessageService {


    /**
     * Created by hanzishuai on 2025/4/13
     * @param id  站内信 Id
     * @return com.example.forum.model.Message
     * @Description  根据站内信 Id 查询站内信
     */
    Message selectById(Long id);

    /**
     * Created by hanzishuai on 2025/4/13
     *
     * @param message 要发送的信息
     * @return void
     * @Description 发送站内信息
     */
    void create(Message message);


    /**
     * Created by hanzishuai on 2025/4/13
     *
     * @param receiveUserId 用户Id
     * @return java.lang.Integer 未读数量
     * @Description 根据用户Id查询该用户未读数量
     */
    Integer selectUnreadCount(Long receiveUserId);

    /**
     * Created by hanzishuai on 2025/4/13
     *
     * @param receiveUserId 接收方用户Id
     * @return java.util.List<com.example.forum.model.Message>
     * @Description 根据接收者用户Id查询所有站内信
     */
    List<Message> selectByReceiveUserId(Long receiveUserId);


    /**
     * Created by hanzishuai on 2025/4/13
     * @param id 站内信 id
     * @param state 目标状态
     * @return void
     * @Description 根据 Id 更新指定站内信的状态
     */
    void updateStateById(Long id,Byte state);




    /**
     * Created by hanzishuai on 2025/4/13
     * @param repliedId 要回复的站内信 Id
     * @param message  要回复的对象
     * @return void
     * @Description  根据 Id 回复站内信
     */
    @Transactional
    void reply(Long repliedId,Message message);


}


















